<?php
// card id  pe2K2jueSlpaafyz1PB30pXpeInk
ini_set('display_errors', 'On');
 
function httpGet($url) {
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_TIMEOUT, 500);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_URL, $url);
    
    $res = curl_exec($curl);
    curl_close($curl);
    var_dump($res);
    
    return $res;
}


$appId='wx_zhiguang';
$appSecret='wn22d01hged73s82le';

$url='http://sweixinapi.hisense.com/openapi/token?grant_type=client_credential&appid='.$appId.'&secret='.$appSecret;

echo $url;
echo "<br />";

$data=json_decode(httpGet($url),true);
$hai_token=$data['access_token'];
echo "<br />";


$url='http://sweixinapi.hisense.com/interface/weChatExternal/qryAccessToken?access_token='.$hai_token;

 
$data=json_decode(httpGet($url),true);
 
$access_token=$data['data'];

$url='https://api.weixin.qq.com/cgi-bin/get_api_domain_ip?access_token='.$access_token;
$data=file_get_contents($url);
var_dump($data);
echo "<br />";

$url = "https://api.weixin.qq.com/card/batchget?access_token=".$access_token;
echo $url;
echo "<br />";
echo "<br />";
echo "<br />";

$data='{
  "offset": 26,
  "count": 10,
   "status_list": ["CARD_STATUS_VERIFY_OK", "CARD_STATUS_DISPATCH"]
}';
$res = https_request( $url ,'post', 'json', $data);
echo "<br />";
echo "<br />";
var_dump($res);

echo "<br />";



function https_request($url, $type="get", $res="json", $data = ''){
    //1.初始化curl
    $curl = curl_init();
    //2.设置curl的参数
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_SAFE_UPLOAD, true);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    if ($type == "post"){
        curl_setopt($curl, CURLOPT_POST, 1);
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    }
    //3.采集
    $output = curl_exec($curl);
    //var_dump(curl_getinfo($curl));
    //4.关闭
    curl_close($curl);
    if ($res == 'json') {
        return json_decode($output,true);
    }
}
 
  


 